package com.manjason.property.enums;

public enum PropertyType {
    PHYSICAL(1, "力量"),
    QUICK(2, "敏捷"),
    LUCK(3, "幸运"),
    PHYSIQUE(4, "体质"),
    IQ(5, "智力"),
    SPIRIT(6, "精神");

    private int index;
    private String name;

    PropertyType(int index, String name) {
        this.index = index;
        this.name = name;
    }

    public static PropertyType getPropertyTypeByName (String name) {
        if(null == name){
            return null;
        }
        for(PropertyType temp:PropertyType.values()){
            if(temp.getName().equalsIgnoreCase(name)){
                return temp;
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return "类型" + this.index + "=" + this.name;
    }

    public int getIndex() {
        return index;
    }

    public String getName() {
        return name;
    }
}
